//
//  SSSTabBarController.m
//  SSSMerchant
//
//  Created by Darker on 2017/4/14.
//  Copyright © 2017年 xnxin. All rights reserved.
//

#import "SSSTabBarController.h"
#import "SSSHomeViewController.h"
#import "SSSPersonCenterController.h"
#import "SSSMyIncomeViewController.h"
#import "SSSForgetPasswordViewController.h"
#import "SSSMerchantBenefitPagerController.h"

@interface SSSTabBarController ()<UITabBarControllerDelegate>

@end

@implementation SSSTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.delegate = self;
    
    SSSHomeViewController *home=[SSSHomeViewController new];
    home.view.backgroundColor = [UIColor redColor];
    home.hidesBottomBarWhenPushed = NO;
    QMUINavigationController *homeNav= [[QMUINavigationController alloc]
                                        initWithRootViewController:home];
    
    homeNav.tabBarItem.title = @"首页";
    homeNav.tabBarItem.image = [UIImage imageNamed:@"icon_home_06"];
    
    //    UIViewController *inCome = [SSSMyIncomeViewController new];
    //    inCome.view.backgroundColor = [UIColor blueColor];
    //    inCome.hidesBottomBarWhenPushed = NO;
    //    QMUINavigationController *inComeNav = [[QMUINavigationController alloc]
    //                                           initWithRootViewController:inCome];
    //    inComeNav.tabBarItem.title = @"我的收益";
    //    inComeNav.tabBarItem.image = [UIImage imageNamed:@"icon_home_07"];
    
    UIViewController *merchant = [SSSMerchantBenefitPagerController new];
    QMUINavigationController *merchantNav = [[QMUINavigationController alloc]
                                             initWithRootViewController:merchant];
    merchantNav.tabBarItem.title = @"店铺收益";
    merchantNav.tabBarItem.image = [UIImage imageNamed:@"icon_home_07"];
    merchant.hidesBottomBarWhenPushed = NO;
    
    SSSPersonCenterController *personal = [SSSPersonCenterController new];
    //personal.view.backgroundColor = [UIColor brownColor];
    personal.hidesBottomBarWhenPushed = NO;
    QMUINavigationController *personalNav = [[QMUINavigationController alloc]
                                             initWithRootViewController:personal];
    personalNav.tabBarItem.title = @"个人中心";
    personalNav.tabBarItem.image = [UIImage imageNamed:@"icon_home_08"];
    personal.hidesBottomBarWhenPushed = NO;
    self.viewControllers = @[homeNav, merchantNav, personalNav];

}
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
    
    if ([SSSBusinessModel sharedInstance].businessID == 0) {
        showTipHudStr(@"请选择店铺");
        return NO;
    }else{
        return YES;
    }
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
